<div class="layui-layout layui-layout-admin" style="padding-left: 40px;margin-top: 20px; " >
    <form class="layui-form" >
        <div class="layui-form-item"  >
            <h2 style = "text-indent:10em"> 
                给用户【
                <font color="#104E8B" id = "uctrname" ></font>
                】发邮件
            </h2>
        </div>
        <div class="layui-form-item" >
            <label class="layui-form-label" style="width:160px;">收件人游戏推广号：</label>
            <div class="layui-form-mid">
                <font color="#104E8B" id = "uctrlGameID"></font>
            </div>    
        </div>
        <div class="layui-form-item" >
            <label class="layui-form-label"  style="width:160px;">邮件标题：</label>
            <div class="layui-input-block">
                    <textarea style="height:50px;width:400px" name="uMailTitle" id="uMailTitle" placeholder="请输入内容" lay-verify="required" class="layui-textarea" maxlength="127"></textarea>
            </div>
        </div>

        <div class="layui-form-item" >
            <label class="layui-form-label"  style="width:160px;">邮件金币：</label>
            <div class="layui-input-inline">
                   <input class="layui-input" type="number" name="uGetGold" id="uGetGold" autocomplete="off"  lay-verify="required"  value="0"  min = "0" max = "1000000" >
            </div> 
             <div class="layui-form-mid">
                <font color="#FF0000">
                    *邮件补偿值范围设为0-100万！
                </font>
            </div> 
        </div>
        <div class="layui-form-item" >
            <label class="layui-form-label"  style="width:160px;">邮件内容：</label>
            <div class="layui-input-block">
                    <textarea style="height:100px;width:400px" name="mailContent" id="mailContent" placeholder="请输入内容" lay-verify="required" class="layui-textarea" maxlength="511"></textarea>
            </div>
           
        </div>


        <div class="layui-form-item" style = "text-indent:16em" >
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="useroprater" >确定发送</button>
            </div>
        </div>
    </form>
</div>
<script>
var $;
    layui.config({
            base : "js/"
    }).use(['form','element','layer','jquery'],function(){
        var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
        var $ = layui.jquery;

        ShowContlrDatas();
        form.on('submit(useroprater)', function(data){
            var mailContent = document.getElementById("mailContent");
            var uMailTitle = document.getElementById("uMailTitle");
            var uGetGold = document.getElementById("uGetGold");
            if (uGetGold.value >= 0 && uGetGold.value <= 1000000)
            {
          
                var form_data = {
                    'uCtrlType': [|.uCtrlType|]
                    ,'uCtrlUserID': localStorage["gameid"]
                    ,'uUserID': localStorage["UserID"]
                    ,'uCtrlName': localStorage["unickname"]
                    ,'uMailTitle': uMailTitle.value
                    ,'uGetGold': uGetGold.value
                    ,'mailContent': mailContent.value
                }
                layer.confirm('你确定给用户：【'+ localStorage["unickname"]+'】发邮件么？', function(index){
                    $.post('[|urlfor "UsersFinduserController.UserContrlInfo"|]', form_data, function (out) {
                        if (out.status == 0) {
                            layer.msg(out.message,{icon: 1},function () {
                                window.location.reload()
                            })
                        } else {
                            layer.msg(out.message)
                        }
                    }, "json");
                });
                return false;
             }
          
        });
    return false;
}); 
function ShowContlrDatas(){
    var uctrname =  document.getElementById("uctrname");
    uctrname.innerHTML=localStorage["unickname"];
    var uctrlGameID =  document.getElementById("uctrlGameID");
    uctrlGameID.innerHTML=localStorage["gameid"];

}
</script>